package com.ghsc.ghxc.jsb.ui.message.activity

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.message.bean.GroupUserInfoResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.message.activity
 * 类名：MyChatViewModel
 * 创建时间：2024/5/7 22:41
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class MyChatViewModel : BaseViewModel() {


    /**  根据群id 查询个人信息 是否是管理员或者群主 **/
    var onGroupUserInfoData = MutableLiveData<BaseResponse<GroupUserInfoResult>>()
    fun onGroupUserInfoMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onGroupUserInfoData(paras) }
            executeResponse(
                response,
                { onGroupUserInfoData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }
        }
    }

}